package com.xwj.controller;

import com.xwj.domain.Order;
import com.xwj.dto.CommonResult;
import com.xwj.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xwj
 * @date 2020/11/21
 */
@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/order/create")
    public CommonResult create(Order order) {
        try {
            orderService.create(order);
            return new CommonResult(200, "订单创建成功");
        } catch (Exception e) {
            return CommonResult.error(e.getMessage());
        }
    }
}
